package test_3_15;

import java.util.Arrays;

public class one {
    public static void main(String[] args) {
        int []arr={1,5,3,4,2,6};
        Arrays.sort(arr);
        int left=0;
        int right=arr.length-1;
        while(left<=right)
        {
            if(left<=right && arr[left]%2!=0)
            {
                left++;
            }
            if(left<=right && arr[right]%2==0)
            {
                right--;
            }
            if(left<right)
            {
                int tmp=arr[left];
                arr[left]=arr[right];
                arr[right]=tmp;
                left++;
                right--;
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
